import { util } from '@kit.ArkTS';
import { FileManager, FilePathGenerator } from 'CoffeeSdk';

export class SignHelper {
    static generateKey() {
        let uuid = util.generateRandomUUID();
        return uuid;
    }


    static getSignInitPath(key:string):string {
        return `${FilePathGenerator.cacheDir}/${key}/init.sign`
    }

    static getSignSavePath(key:string):string {
        return `${FilePathGenerator.cacheDir}/${key}/index.sign`
    }

    static clearSign(key:string) {
        let initPath = this.getSignInitPath(key);
        let signPath = this.getSignSavePath(key);
        let jpgPath = this.getSignJpgPath(key);
        FileManager.cleanFile(initPath);
        FileManager.cleanFile(signPath);
        FileManager.removeFile(jpgPath);
    }

    static getSignJpgPath(key:string):string {
        return `${FilePathGenerator.cacheDir}/${key}/index.jpg`
    }
}